<template>
  <div class="list">
    <el-table class="configTable" :data="tableData" style="width: 100%">
      <el-table-column prop="id" label="ID" align="center"></el-table-column>
      <el-table-column prop="type" label="type" align="center"></el-table-column>
      <el-table-column prop="title" label="title" align="center">
        <template slot-scope="scope">{{scope.row.screen_config.title}}</template>
      </el-table-column>
      <el-table-column prop="add_time" label="添加时间" align="center"></el-table-column>
      <el-table-column prop="update_time" label="更新时间" align="center"></el-table-column>
      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-button size="mini" type="primary" @click="edit(scope.row)">编辑</el-button>
          <el-button size="mini" @click="open(scope.row)">打开</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      class="configPagin"
      :page-size="15"
      layout="total, prev, pager, next"
      :total="total"
    ></el-pagination>
  </div>
</template>

<script>
import { ConfigScreenList } from "@/api/pageConfig";
export default {
  name: "pageConfigList",
  data() {
    return {
      total: 2,
      tableData: []
    };
  },
  mounted() {
    this.initial();
  },
  methods: {
    async initial() {
      let result = await ConfigScreenList();
      if (result.code == 200) {
        this.tableData = result.data.data;
      }
    },
    edit(row) {
      console.log("row", row);
      this.$router.push("/pageConfig/edit?type=" + row.type);
    },
    open(row) {
      window.open("http://web.zhgylgl.com/screen/#/?type=" + row.type);
    }
  }
};
</script>

<style lang="scss" scoped>
.list {
  padding: 10px;
  .configTable {
    min-height: 80vh;
  }
  .configPagin {
    margin-top: 20px;
  }
}
</style>
